package woa.test;

/**
 * @author wangpeng
 * @version 1.0
 * @date 2024/10/28 20:39
 */
public class ThreadTest1 {

    public static void main(String[] args) {
        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                synchronized (this) {
                    System.out.println("thread1 start");
                    notify();
                    System.out.println("thread1 end");
                }
            }
        });

        synchronized (thread1) {
            try {
                thread1.start();
                System.out.println("thread1 wait start");
                Thread.sleep(3000);
                thread1.wait();
                System.out.println("thread1 wait end");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
